package com.appistry.management.domain;

import org.json.JSONException;

import com.appistry.api.rest.domain.RestResponse;
import com.appistry.management.exception.FabricManagerRestException;

public class AbstractRestDomainObject {
	public static final String PARSE_JSON_ERR = "Unable to parse JSON!";
	public static final String NOT_IMPLEMENT = "Not yet implemented!";

	/**
	 * Helper method that checks a rest response for error codes.
	 * @param response
	 * @throws JSONException
	 * @throws FabricManagerRestException
	 */
	protected void checkForErrors(RestResponse response) throws JSONException, FabricManagerRestException {
		if (response.getStatusCode() != 200 && response.getStatusCode() != 202) {
			throw new FabricManagerRestException(response);
		}
	}
	
}
